<xsl:stylesheet version="2.0"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
	xmlns:d="http://www.daimi.au.dk/dWebTek/directionML">

<xsl:template match="d:drivingDirection"> 
<html>
<head>
	<title>Directions</title>
</head>
		<body>
			<h2>Directions from 
					<xsl:value-of select="d:start/@address"/>, 
					<xsl:value-of select="d:start/@state"/> to  
					<xsl:value-of select="d:end/@address"/>, 
					<xsl:value-of select="d:end/@state"/>
				</h2>
					
				<ul>
					<li>Est. time: <xsl:apply-templates select="d:totalEstTime"/></li>
					<li>Est. distance: <xsl:apply-templates select="d:totalEstDistance"/></li>
				</ul>
				<ol>
					<xsl:apply-templates select="d:directionPoint"/>
				</ol>
			</body>
		</html>
</xsl:template>

<xsl:template match="d:directionPoint">
				<li><xsl:apply-templates select="d:*"/> <xsl:text> </xsl:text>
				<xsl:value-of select="@length"/></li>
</xsl:template>

<xsl:template match="d:on">
	on <xsl:value-of select="text()"/>
</xsl:template>

<xsl:template match="d:startOutGoing">
	Start out going <xsl:value-of select="text()"/>
</xsl:template>

<xsl:template match="d:toward">
	toward <xsl:value-of select="text()"/>
</xsl:template>

<xsl:template match="d:turnLeftOnto">
	Turn left onto <xsl:value-of select="text()"/>
</xsl:template>

<xsl:template match="d:turnRightOnto">
	Turn right onto <xsl:value-of select="text()"/>
</xsl:template>

<xsl:template match="d:mergeOnto">
	Merge onto <xsl:value-of select="text()"/>
</xsl:template>

<xsl:template match="d:via">
	via <xsl:value-of select="text()"/>
</xsl:template>

<xsl:template match="d:turnSlightOnto">
	Turn Slight onto <xsl:value-of select="text()"/>
</xsl:template>

<xsl:template match="d:becomes">
	<xsl:apply-templates select="d:before"/>
	becomes
	<xsl:apply-templates select="d:after"/>
</xsl:template>

<xsl:template match="d:takeThe">
	Take the <xsl:apply-templates select="*"/>
</xsl:template>

<xsl:template match="d:turnSlightRightOnto">
	Turn slight right onto <xsl:value-of select="text()"/>
</xsl:template>

<xsl:template match="d:onThe">
	on the <xsl:value-of select="text()"/>
</xsl:template>

<xsl:template match="d:before|d:after">
	<xsl:value-of select="text()"/>
</xsl:template>

<xsl:template match="d:totalEstTime">
	<xsl:value-of select="@hours"/> hours, <xsl:value-of select="@minutes"/> minutes
</xsl:template>

<xsl:template match="d:totalEstDistance">
	<xsl:value-of select="@length"/> miles
</xsl:template>
	
	
</xsl:stylesheet>
